home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / lib / posix / utime.c < prev    next >
C/C++ Source or Header  |  1990-07-23  |  502b  |  27 lines

  1. /* utime(2) for POSIX        Authors: Terrence W. Holm & Edwin L. Froese */
  2.  
  3. #include <lib.h>
  4. #include <stddef.h>
  5. #include <time.h>
  6. #include <utime.h>
  7.  
  8. PUBLIC int utime(name, timp)
  9. char *name;
  10. struct utimbuf *timp;
  11. {
  12.   long current_time;
  13.  
  14.   if (timp == (struct utimbuf *)NULL) {
  15.     current_time = time((long *)NULL);
  16.     _M.m2_l1 = current_time;
  17.     _M.m2_l2 = current_time;
  18.   } else {
  19.     _M.m2_l1 = timp->actime;
  20.     _M.m2_l2 = timp->modtime;
  21.   }
  22.  
  23.   _M.m2_i1 = len(name);
  24.   _M.m2_p1 = name;
  25.   return callx(FS, UTIME);
  26. }
  27.